home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 4725 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.8 KB

  1. Path: ssc.sas.upenn.edu!modavis
  2. From: modavis@ssc.sas.upenn.edu (Morris A. Davis)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Math Functions
  5. Date: 6 Feb 1996 17:35:54 GMT
  6. Organization: University of Pennsylvania
  7. Distribution: world
  8. Message-ID: <4f83hq$mva@netnews.upenn.edu>
  9. References: <4f7m6m$b4j@server1.ctc.com>
  10. NNTP-Posting-Host: ssc.sas.upenn.edu
  11. X-Newsreader: TIN [version 1.2 PL2-upenn1.1]
  12.  
  13. Matt Cunningham (cunning@CTC.COM) wrote:
  14. : I'm trying to find out if I can do matrix math using C.  I am working on the 
  15. : SGI platform (Irix 5.3) and I want to know if I can do complex numbers,
  16. : define matrices, take the determinant of matrices etc.  Any ideas of if I
  17. : can do this and how?
  18.  
  19. 1.  You can define matrices in C 
  20.     double mymatrix[10][20];
  21. initializes a double precision 10x20 matrix called "mymatrix"
  22. 2.  If you buy book "Numerical Recipes in C", you'll find a nice listing
  23. for the Gauss-Jordan decomposition (matrix inversion/solution to a
  24. system of equations....).  There's a big fixed cost to entering in this
  25. program yourself (you have to type in a very long include file...)
  26. 3.  I don't know about complex numbers.  In the K&R book, the sqrt(x)
  27. is defined with the listing x>=0 (p.251).  I'm sure with clever
  28. programming and checks, you can remember which square roots should have
  29. the "i" and which shouldn't.
  30.  
  31. I'll get flamed for this, but:
  32. May I suggest, however, that you think about using MATLAB for your
  33. matrix needs.  MATLAB is much slower than C, however. (that may change
  34. soon with the intrduction of a Matlab to C compiler).  If you really
  35. need speed, you can't go with MATLAB.  If speed is a secondary issue,
  36. you might think about using MATLAB.
  37.  
  38. Regards, Morris
  39.  
  40. : Thanks
  41.  
  42. : -- 
  43. : Matt Cunningham
  44. : (814) 269-2695
  45. : Associate Software Engineer
  46. : Concurrent Technologies Corporation
  47.